//
//  DetailViewController.m
//  JZRJAPP
//
//  Created by mac on 16/5/13.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "DetailViewController.h"
#import "FourTitleViewCell.h"
#import "LiuXSegmentView.h"
@interface DetailViewController ()

@end
static NSString *indentFile = @"cell";
@implementation DetailViewController

//-(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil{
//    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
//    if (self) {
//        self.hidesBottomBarWhenPushed = YES;
//    }
//    return self;
//}
- (instancetype)init
{
    self = [super init];
    if (self) {
        // 隐藏上一个页面传来的tabbar
        self.hidesBottomBarWhenPushed = YES;
        
        // 左边按钮
        self.navigationItem.leftBarButtonItem =[[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"back"] style:UIBarButtonItemStyleDone target:self action:@selector(back:)];
        // 右边按钮
        self.navigationItem.rightBarButtonItem =[[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"search"] style:UIBarButtonItemStyleDone target:self action:@selector(seach:)];
        
    }
    return self;
}
// 返回按钮
-(void)back:(UIBarButtonItem *)sender{
    
    [self.navigationController popViewControllerAnimated:YES];
}

// 搜索按钮

-(void)seach:(UIBarButtonItem *)sender{
    
    NSLog(@"跳转搜索页面");
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
     [self.tableView registerNib:[UINib nibWithNibName:@"FourTitleViewCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:indentFile];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 1;
}

//每个分区的高
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return 60;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.section == 1) {
        
        FourTitleViewCell *cell = [tableView dequeueReusableCellWithIdentifier:indentFile forIndexPath:indexPath];
        cell.textLabel.text = @"测试";
        return cell;
    }
    return nil;
}
  
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    if (section == 1) {
        LiuXSegmentView *view = [[LiuXSegmentView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 60) titles:@[@"技术面",@"基本面",@"资金",@"消息"] clickBlick:^(NSInteger index) {
            NSLog(@"-----%ld",index);
            
        }];
        return view;
    }
    return nil;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    
    return 60;
}
/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the specified item to be editable.
    return YES;
}
*/

/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
    } else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }   
}
*/

/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/

/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
